Construction of phasor Array

Intro

The phasorArray class is a usefull tool to manipulate 3D array representing Periodic matrix, storing complex phasor along the third dimension. Obligatory, third dimension must me an odd number.
Let's use the class PhasorArray to attach usefull function to a 3D matrix representing a periodic matrix and its phasor.
Consider A a 3D array of size , A(:,:,h+1) is the 0-phasor of A, and are the and m phaors of A.
The class allow construction, manipulation, edition of phasor in a smooth manner, and redifine all the basic operation (addition, substraction, multiplication, left/right inversion, transposition, conj transpore, real, imag ....) to apply to the periodic matrix instead of the array operation.

Construting a phasorArray

From fourier coefficient : Construct A a 3D table, from phasor -2 to 2, use PhasorArray to create the object.

A_0=eye(2);
A_1=[1 1i;-1i,2];
A_2=[2*1i, exp(1i*1.89)/4; 0.5, -1];
 
A_ar=cat(3,conj(A_2),conj(A_1),A_0,A_1,A_2);
A=PhasorArray(A_ar)
A = 2x2x5 PhasorArray of double representing a 2x2 real-valued periodic matrix with 2 harmonics
Alternatively, specify that A represent a real valued periodic matrix, ie negative phasor are the conjugate of positive phasor, and feed the function only with the Zero and Positive part, and speficify the argument 'z_pospart' to true
A_arpos=cat(3,A_0,A_1,A_2);
A=PhasorArray(A_arpos,'z_pospart',true)
A = 2x2x5 PhasorArray of double representing a 2x2 real-valued periodic matrix with 2 harmonics
The last way to construct PhasorArray is to specifiy individual periodic coefficient.
For that you can avoid the hassle to construct a 3D matrix, and provide a vector in order to define a scalar periodic PhasorArray. Using this, individual coeef can have different number of phasor but can still concatenate
a_11=ScalarPhasorArray([1,1,2*1i],'z_pospart',true)
a_11 = 1x1x5 PhasorArray of double representing a 1x1 real-valued periodic matrix with 2 harmonics
a_12=ScalarPhasorArray([0,1i,exp(1i*1.89)/4, 1/7, 1/8*1i ],'z_pospart',true)
a_12 = 1x1x9 PhasorArray of double representing a 1x1 real-valued periodic matrix with 4 harmonics
a_21=ScalarPhasorArray([0,-1i,0.5],'z_pospart',true)
a_21 = 1x1x5 PhasorArray of double representing a 1x1 real-valued periodic matrix with 2 harmonics
a_22=ScalarPhasorArray([1,2,-1],'z_pospart',true)
a_22 = 1x1x5 PhasorArray of double representing a 1x1 real-valued periodic matrix with 2 harmonics
 
A=[a_11,a_12;a_21,a_22]
A = 2x2x9 PhasorArray of double representing a 2x2 real-valued periodic matrix with 4 harmonics

From a time signal : use inverse FFT to deduce correct Fourier decomposition and build the phasorArray object

T=2
T = 2
sig = @(t) sawtooth(t/T*2*pi,0.5)
sig = function_handle with value:
@(t)sawtooth(t/T*2*pi,0.5)
figure
plot(0:1e-3:4,sig(0:1e-3:4))
 
choose an appropriate power of 2
dt = 1/2^4;
t=(0:dt:(1-dt))*T;
 
y = sig(t);
Use the time2phasor method with a signal sample from 0 to T-dt on 2^m points
Y=PhasorArray.time2Phasor(y,"timeDim",2)
Y = 1x1x15 PhasorArray of double representing a 1x1 real-valued periodic matrix with 7 harmonics
hold on
plot(Y,T,0:1e-3:4,linetype='-.')
sgtitle('y(t) vs Y->y')
 
YY = PhasorArray.funcToPhasorArray(sig,T);
Warning: The function has discontinuities, or a steep derivative at the end, or has a jump between the last and first value, the result may be incorrect. Jump value is 2.500000e-01 (froebenius norm of f(T-dt)-f(0))
hold on
plot(YY,T)
legend('y','y->Y->y','sig->Y->y')

Display phasorArray

Display the 3D table inside, ie the fourier coeeficients
%display the 3D array
A.value
ans =
ans(:,:,1) = 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,2) = 0.0000 + 0.0000i 0.1429 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,3) = 0.0000 - 2.0000i -0.0785 - 0.2374i 0.5000 + 0.0000i -1.0000 + 0.0000i ans(:,:,4) = 1.0000 + 0.0000i 0.0000 - 1.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i ans(:,:,5) = 1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i ans(:,:,6) = 1.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 - 1.0000i 2.0000 + 0.0000i ans(:,:,7) = 0.0000 + 2.0000i -0.0785 + 0.2374i 0.5000 + 0.0000i -1.0000 + 0.0000i ans(:,:,8) = 0.0000 + 0.0000i 0.1429 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,9) = 0.0000 + 0.0000i 0.0000 + 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i
Display a stem plot of fourier coefficients, either showing real part, imag part, both, or abs. Default is an explosed view, one subplot for each coeeficient of A(t)
%stem plot
figure
clf
stem(A,display="real",scale="linear")
sgtitle('Stem of real part of Phasor of A')
 
figure
clf
stem(A,display="imag",scale="linear")
sgtitle('Stem of imag part of Phasor of A')
 
figure
clf
stem(A,display="abs",scale="linear")
sgtitle('Stem of abs value of Phasor of A')
Plot a time domain realisation of A(t) on a given time vector, for a given period T
%temporal plot
figure
clf
tt=0:0.001:4;
T=2;
plot(A,T,tt,"title",'A(t)')
Alternatively to stem, plot the abs value of phasor in a 3D bar chart, beware, as the matrix is first vectorized one direction
figure
barsurf(A)
The explosed option of stem can be disabled, resulting in a superposition of the different harmonics
figure
stem(A,"explosed",0,"scale","linear")

Perform derivation and phase shift

figure
plot(d(A,2),2,0:0.001:4,"title","A(t)'") %derivative of A, for a period T=2
 
figure
plot(dephase(A,pi/2),2,0:0.001:4,"title","A(t+T/4)") %dephasage de A de pi/2 rad

Edit PhasorArray

You can modify value of PhasorArray by two means
Access 3D array using parenthesis to manipulate it as a 3D array in regular matlab way
A(1,1,3)=5 % access the third page of 3D array, since A is of size 5,
A = 2x2x9 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 4 harmonics
% the 3rd page is the central page,
% so it is the 0 phasor,
% since we specify (1,1,3) we edit the value of the first coeeficient of
% A(t)
 
A(1,1,(A.h+1)+0) = 5 %A.h produces the number of phasor in A
A = 2x2x9 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 4 harmonics
% so (A.h+1)+k is the index of the k-th phasor page
Alternatively use bracket with 2 indices to access coefficient subphasor array, you can use bracket indexing to totaly replace phasor value of specified coefficients
A{1,1} %extract the phasor Array of (1,1) element of A(t)
ans = 1x1x9 PhasorArray of double representing a 1x1 complex-valued periodic matrix with 4 harmonics
figure
plot(A)
 
 
figure
plot(A{1,1})
 
A{1,1}=9;
hold on
plot(A{1,1})
 
A{1,1}=ScalarPhasorArray([5 1/2*1i],'z_pospart',true); %replace a_11 with 5-sin(wt)
hold on
plot(A{1,1})
You can also use bracket with 3 indices to assign to specific phasor BUT unlike parenthesis indexing the third argument is a phasor indices
A{1,1,1}
ans = 0.0000 + 0.5000i
A(1,1,1+1+A.h)
ans = 0.0000 + 0.5000i
A{1,1:2,7}
ans = 1×2
0 0
A{:,:,-4}
ans = 2×2 complex
0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i
 
%change value of phasor -3 of a_11 and a_12
A{1,1:2,-3}=[1/4*1i 1/3+1i/5]
A = 2x2x9 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 4 harmonics
 
A{1,2,12}=0.1
A = 2x2x25 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 12 harmonics
A{1,2,-12}=0.1
A = 2x2x25 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 12 harmonics
To access full phasor of order k, an alternative to A{:,:,k} is A.phas(k)
A.phas(-3)
ans = 2×2 complex
0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 + 0.0000i
finally use A{:} to extract a vector form of A
A{:}
ans = 4x1x25 PhasorArray of double representing a 4x1 complex-valued periodic matrix with 12 harmonics
figure
plot(A{:})
Use trunc et reduce pour réduire les phasor Array
E=rand_phasor(2,2,100,'output','PhasorArray')
E = 2x2x201 PhasorArray of double representing a 2x2 real-valued periodic matrix with 100 harmonics
figure
stem(E)
 
figure
stem(E.trunc(5))
 
figure
stem(E.reduce('reduceMethod','absolute','reduceThreshold',1e-2))
coupe des que tous les phasors après sont plus petit que 1e-2
 
hold on
stem(E.reduce('reduceMethod','relative','reduceThreshold',1e-2),'marker','>')
coupe des que tous les phasors après sont plus petit que 1e-2 fois le max des phasors

Basic manipulation

We want to manipulate the 3D array (Phasor Array) as is they are matrices. Hence we redefine the + * .* / ./ ' .' operateur to produce result on the periodic matrices.
A+4 (addition with a scalar) adds 4 only to the 0 phasor, C=A*B realise the product of the periodic matrices st , the is element wise product too : C=A.*B means and so on for matrix division and element wise division.
PhasorArray class define the addition in the sens of Matrix : AA=A+4 adds 4 only to the 0 phasor of A
AA=A+8*eye(2)
AA = 2x2x25 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 12 harmonics
figure
plot(A)
hold on
plot(AA)
 
 
B=1/AA;
figure
plot(B,title='B(t)')
hold on
plot(B*AA,title='B(t)*AA(t)')
 
C=rand_phasor(2,2,5,"output","PhasorArray","time_structure","real")
C = 2x2x11 PhasorArray of double representing a 2x2 real-valued periodic matrix with 5 harmonics
figure
plot(C,title='C(t)')
figure
stem(C)
figure
plot(A*C,title='product A(t) \times C(t)')
 
 
figure
clf
stem(A*C)
figure
clf
plot(A.') %transpose et complexe transpose fonctionnent
hold on
plot(A)
 
You can perform smoothly addition and substraction of phasor array containing a different number of phasor as long as the first two dimmension are compatible
D=rand_phasor(2,2,4)
D =
D(:,:,1) = 0.0799 + 0.0128i -0.1056 + 0.0840i 0.0348 + 0.0098i 0.0420 - 0.0757i D(:,:,2) = -0.1245 + 0.0012i 0.1491 - 0.1526i 0.1292 - 0.0635i -0.0785 - 0.0783i D(:,:,3) = -0.0108 - 0.0835i 0.1956 - 0.0848i -0.2131 + 0.1557i 0.3346 - 0.2093i D(:,:,4) = 1.0897 + 0.5657i -0.0662 - 0.2280i 0.8723 - 0.6813i -0.1629 - 1.4889i D(:,:,5) = 1.3061 + 0.0000i 1.0266 + 0.0000i -3.5503 + 0.0000i -6.6540 + 0.0000i D(:,:,6) = 1.0897 - 0.5657i -0.0662 + 0.2280i 0.8723 + 0.6813i -0.1629 + 1.4889i D(:,:,7) = -0.0108 + 0.0835i 0.1956 + 0.0848i -0.2131 - 0.1557i 0.3346 + 0.2093i D(:,:,8) = -0.1245 - 0.0012i 0.1491 + 0.1526i 0.1292 + 0.0635i -0.0785 + 0.0783i D(:,:,9) = 0.0799 - 0.0128i -0.1056 - 0.0840i 0.0348 - 0.0098i 0.0420 + 0.0757i
E=A-D
E = 2x2x25 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 12 harmonics
 
F=kron(A,D)
F = 4x4x33 PhasorArray of double representing a 4x4 complex-valued periodic matrix with 16 harmonics
Basic function such as sum, trace, diag etc are available
diag(A)
ans = 2x1x25 PhasorArray of double representing a 2x1 complex-valued periodic matrix with 12 harmonics
figure
plot(diag(A))
 
trace(A)
ans = 1x1x25 PhasorArray of double representing a 1x1 complex-valued periodic matrix with 12 harmonics
figure
plot(trace(A))
 
N.B. notice that
Power are defined
figure
plot(A)
figure
plot(A^3)
figure
plot(A.^5)

Simulation of system

Lets take a random periodic matrix with imposed eigen value on S-N
figure
S=mreal(rand_phasor(2,2,7,"hurwitzeig",[-1 -0.3],"time_structure","hurwitz",output="PhasorArray"))
S = 2x2x15 PhasorArray of double representing a 2x2 real-valued periodic matrix with 7 harmonics
 
tmax=15;
T=1
T = 1
x0=rand(2,1);
[y,t]=lsim(S,tmax,x0,T,"plot",true,"isRealValued",1);
3846 successful steps 0 failed attempts 4151 function evaluations 1 partial derivatives 303 LU decompositions 4149 solutions of linear systems
%isRealValue ensure only real value are used, tune this argument to true if
%the periodic matrices are real valued
title('x(t)')
 
figure
plot(S{:},T,0:0.01:tmax,title='S(t)')
 
figure
plot(S.HmqNEig([],T),'*')
title('eig(S-N)')
 
We now add an input to the simulation
B=PhasorArray.random(2,1,5,"time_structure","real")+3
B = 2x1x11 PhasorArray of double representing a 2x1 real-valued periodic matrix with 5 harmonics
figure
plot(B,T,0:0.01:tmax)
 
figure
[y,t]=lsim(S,tmax,x0,T,B,"plot",true,"isRealValued",1);
3848 successful steps 0 failed attempts 4122 function evaluations 1 partial derivatives 272 LU decompositions 4120 solutions of linear systems
title('x(t)')
 

Advanded manipulation

Take a complexe valued phasor array, you can extract the real part of A(t) and imag part of A(t), conjugate phasor, and transpose conjugate phasor with '
X = rand_phasor(2,2,5,"time_structure","cmplx",output="PhasorArray")
X = 2x2x11 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 5 harmonics
figure
plot(X,1,0:0.01:2,"DispImag",1,"DispReal",1)
 
rX=mreal(X)
rX = 2x2x11 PhasorArray of double representing a 2x2 real-valued periodic matrix with 5 harmonics
figure
plot(rX,1,0:0.01:2,"DispImag",1,"DispReal",1)
 
iX=mimag(X)*1i
iX = 2x2x11 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 5 harmonics
figure
plot(iX,1,0:0.01:2,"DispImag",1,"DispReal",1)
 
cX=mconj(X)
cX = 2x2x11 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 5 harmonics
figure
plot(cX,1,0:0.01:2,"DispImag",1,"DispReal",1)
 
tcX=X'
tcX = 2x2x11 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 5 harmonics
figure
plot(tcX,1,0:0.01:2,"DispImag",1,"DispReal",1)
 
 

Harmonic Array

Construct the Toeplitz Block Form and BlockToeplitz form of order h using the BT and TB method
h=5
h = 5
 
%TB and BT matrix
A.TB(h)
ans = 22×22 complex
5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.2500i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i -0.0785 - 0.2374i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 5.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.1429 + 0.0000i -0.0785 + 0.2374i 0.0000 + 1.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i
A.BT(h)
ans = 22×22 complex
5.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 - 1.0000i 0.0000 + 0.0000i -0.0785 - 0.2374i 0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.5000i 0.0000 + 1.0000i 5.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 - 1.0000i 0.0000 + 0.0000i -0.0785 - 0.2374i 0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 1.0000i 2.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0785 + 0.2374i 0.0000 + 0.5000i 0.0000 + 1.0000i 5.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 - 1.0000i 0.0000 + 0.0000i -0.0785 - 0.2374i 0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 - 1.0000i 2.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.1429 + 0.0000i 0.0000 + 0.0000i -0.0785 + 0.2374i 0.0000 + 0.5000i 0.0000 + 1.0000i 5.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 - 1.0000i 0.0000 + 0.0000i -0.0785 - 0.2374i 0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 - 1.0000i 2.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.1250i 0.0000 + 0.0000i 0.1429 + 0.0000i 0.0000 + 0.0000i -0.0785 + 0.2374i 0.0000 + 0.5000i 0.0000 + 1.0000i 5.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.5000i 0.0000 - 1.0000i 0.0000 + 0.0000i -0.0785 - 0.2374i 0.0000 + 0.2500i 0.3333 + 0.2000i 0.0000 + 0.0000i 0.0000 - 0.1250i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 - 1.0000i 2.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 1.0000i 2.0000 + 0.0000i 0.5000 + 0.0000i -1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
 
%en version sparse
A.spBT(h)
Warning: NOT IMPLEMENTED YET
ans = 22×22 sparse complex double matrix (194 nonzeros)
(1,1) 5.0000 + 0.0000i (3,1) 0.0000 + 0.5000i (4,1) 0.0000 - 1.0000i (6,1) 0.5000 + 0.0000i (2,2) 1.0000 + 0.0000i (3,2) 0.0000 + 1.0000i (4,2) 2.0000 + 0.0000i (5,2) -0.0785 + 0.2374i (6,2) -1.0000 + 0.0000i (7,2) 0.1429 + 0.0000i (9,2) 0.0000 + 0.1250i (1,3) 0.0000 - 0.5000i (2,3) 0.0000 + 1.0000i (3,3) 5.0000 + 0.0000i (5,3) 0.0000 + 0.5000i (6,3) 0.0000 - 1.0000i (8,3) 0.5000 + 0.0000i (1,4) 0.0000 - 1.0000i (2,4) 2.0000 + 0.0000i (4,4) 1.0000 + 0.0000i (5,4) 0.0000 + 1.0000i (6,4) 2.0000 + 0.0000i (7,4) -0.0785 + 0.2374i (8,4) -1.0000 + 0.0000i (9,4) 0.1429 + 0.0000i (11,4) 0.0000 + 0.1250i (2,5) 0.5000 + 0.0000i (3,5) 0.0000 - 0.5000i (4,5) 0.0000 + 1.0000i (5,5) 5.0000 + 0.0000i (7,5) 0.0000 + 0.5000i (8,5) 0.0000 - 1.0000i (10,5) 0.5000 + 0.0000i (1,6) -0.0785 - 0.2374i (2,6) -1.0000 + 0.0000i (3,6) 0.0000 - 1.0000i (4,6) 2.0000 + 0.0000i (6,6) 1.0000 + 0.0000i (7,6) 0.0000 + 1.0000i (8,6) 2.0000 + 0.0000i (9,6) -0.0785 + 0.2374i (10,6) -1.0000 + 0.0000i (11,6) 0.1429 + 0.0000i (13,6) 0.0000 + 0.1250i (1,7) 0.0000 + 0.2500i (4,7) 0.5000 + 0.0000i (5,7) 0.0000 - 0.5000i (6,7) 0.0000 + 1.0000i (7,7) 5.0000 + 0.0000i (9,7) 0.0000 + 0.5000i (10,7) 0.0000 - 1.0000i (12,7) 0.5000 + 0.0000i (1,8) 0.3333 + 0.2000i (3,8) -0.0785 - 0.2374i (4,8) -1.0000 + 0.0000i (5,8) 0.0000 - 1.0000i (6,8) 2.0000 + 0.0000i (8,8) 1.0000 + 0.0000i (9,8) 0.0000 + 1.0000i (10,8) 2.0000 + 0.0000i (11,8) -0.0785 + 0.2374i (12,8) -1.0000 + 0.0000i (13,8) 0.1429 + 0.0000i (15,8) 0.0000 + 0.1250i (3,9) 0.0000 + 0.2500i (6,9) 0.5000 + 0.0000i (7,9) 0.0000 - 0.5000i (8,9) 0.0000 + 1.0000i (9,9) 5.0000 + 0.0000i (11,9) 0.0000 + 0.5000i (12,9) 0.0000 - 1.0000i (14,9) 0.5000 + 0.0000i (1,10) 0.0000 - 0.1250i (3,10) 0.3333 + 0.2000i (5,10) -0.0785 - 0.2374i (6,10) -1.0000 + 0.0000i (7,10) 0.0000 - 1.0000i (8,10) 2.0000 + 0.0000i (10,10) 1.0000 + 0.0000i (11,10) 0.0000 + 1.0000i (12,10) 2.0000 + 0.0000i (13,10) -0.0785 + 0.2374i (14,10) -1.0000 + 0.0000i (15,10) 0.1429 + 0.0000i (17,10) 0.0000 + 0.1250i (5,11) 0.0000 + 0.2500i (8,11) 0.5000 + 0.0000i (9,11) 0.0000 - 0.5000i (10,11) 0.0000 + 1.0000i (11,11) 5.0000 + 0.0000i (13,11) 0.0000 + 0.5000i (14,11) 0.0000 - 1.0000i (16,11) 0.5000 + 0.0000i (3,12) 0.0000 - 0.1250i (5,12) 0.3333 + 0.2000i (7,12) -0.0785 - 0.2374i (8,12) -1.0000 + 0.0000i (9,12) 0.0000 - 1.0000i (10,12) 2.0000 + 0.0000i (12,12) 1.0000 + 0.0000i (13,12) 0.0000 + 1.0000i (14,12) 2.0000 + 0.0000i (15,12) -0.0785 + 0.2374i (16,12) -1.0000 + 0.0000i (17,12) 0.1429 + 0.0000i (19,12) 0.0000 + 0.1250i (7,13) 0.0000 + 0.2500i (10,13) 0.5000 + 0.0000i (11,13) 0.0000 - 0.5000i (12,13) 0.0000 + 1.0000i (13,13) 5.0000 + 0.0000i (15,13) 0.0000 + 0.5000i (16,13) 0.0000 - 1.0000i (18,13) 0.5000 + 0.0000i (5,14) 0.0000 - 0.1250i (7,14) 0.3333 + 0.2000i (9,14) -0.0785 - 0.2374i (10,14) -1.0000 + 0.0000i (11,14) 0.0000 - 1.0000i (12,14) 2.0000 + 0.0000i (14,14) 1.0000 + 0.0000i (15,14) 0.0000 + 1.0000i (16,14) 2.0000 + 0.0000i (17,14) -0.0785 + 0.2374i (18,14) -1.0000 + 0.0000i (19,14) 0.1429 + 0.0000i (21,14) 0.0000 + 0.1250i (9,15) 0.0000 + 0.2500i (12,15) 0.5000 + 0.0000i (13,15) 0.0000 - 0.5000i (14,15) 0.0000 + 1.0000i (15,15) 5.0000 + 0.0000i (17,15) 0.0000 + 0.5000i (18,15) 0.0000 - 1.0000i (20,15) 0.5000 + 0.0000i (7,16) 0.0000 - 0.1250i (9,16) 0.3333 + 0.2000i (11,16) -0.0785 - 0.2374i (12,16) -1.0000 + 0.0000i (13,16) 0.0000 - 1.0000i (14,16) 2.0000 + 0.0000i (16,16) 1.0000 + 0.0000i (17,16) 0.0000 + 1.0000i (18,16) 2.0000 + 0.0000i (19,16) -0.0785 + 0.2374i (20,16) -1.0000 + 0.0000i (21,16) 0.1429 + 0.0000i (11,17) 0.0000 + 0.2500i (14,17) 0.5000 + 0.0000i (15,17) 0.0000 - 0.5000i (16,17) 0.0000 + 1.0000i (17,17) 5.0000 + 0.0000i (19,17) 0.0000 + 0.5000i (20,17) 0.0000 - 1.0000i (22,17) 0.5000 + 0.0000i (9,18) 0.0000 - 0.1250i (11,18) 0.3333 + 0.2000i (13,18) -0.0785 - 0.2374i (14,18) -1.0000 + 0.0000i (15,18) 0.0000 - 1.0000i (16,18) 2.0000 + 0.0000i (18,18) 1.0000 + 0.0000i (19,18) 0.0000 + 1.0000i (20,18) 2.0000 + 0.0000i (21,18) -0.0785 + 0.2374i (22,18) -1.0000 + 0.0000i (13,19) 0.0000 + 0.2500i (16,19) 0.5000 + 0.0000i (17,19) 0.0000 - 0.5000i (18,19) 0.0000 + 1.0000i (19,19) 5.0000 + 0.0000i (21,19) 0.0000 + 0.5000i (22,19) 0.0000 - 1.0000i (11,20) 0.0000 - 0.1250i (13,20) 0.3333 + 0.2000i (15,20) -0.0785 - 0.2374i (16,20) -1.0000 + 0.0000i (17,20) 0.0000 - 1.0000i (18,20) 2.0000 + 0.0000i (20,20) 1.0000 + 0.0000i (21,20) 0.0000 + 1.0000i (22,20) 2.0000 + 0.0000i (15,21) 0.0000 + 0.2500i (18,21) 0.5000 + 0.0000i (19,21) 0.0000 - 0.5000i (20,21) 0.0000 + 1.0000i (21,21) 5.0000 + 0.0000i (13,22) 0.0000 - 0.1250i (15,22) 0.3333 + 0.2000i (17,22) -0.0785 - 0.2374i (18,22) -1.0000 + 0.0000i (19,22) 0.0000 - 1.0000i (20,22) 2.0000 + 0.0000i (22,22) 1.0000 + 0.0000i
A.spTB(h)
ans = 22×22 sparse complex double matrix (194 nonzeros)
(1,1) 5.0000 + 0.0000i (2,1) 0.0000 + 0.5000i (13,1) 0.0000 - 1.0000i (14,1) 0.5000 + 0.0000i (1,2) 0.0000 - 0.5000i (2,2) 5.0000 + 0.0000i (3,2) 0.0000 + 0.5000i (12,2) 0.0000 + 1.0000i (14,2) 0.0000 - 1.0000i (15,2) 0.5000 + 0.0000i (2,3) 0.0000 - 0.5000i (3,3) 5.0000 + 0.0000i (4,3) 0.0000 + 0.5000i (12,3) 0.5000 + 0.0000i (13,3) 0.0000 + 1.0000i (15,3) 0.0000 - 1.0000i (16,3) 0.5000 + 0.0000i (1,4) 0.0000 + 0.2500i (3,4) 0.0000 - 0.5000i (4,4) 5.0000 + 0.0000i (5,4) 0.0000 + 0.5000i (13,4) 0.5000 + 0.0000i (14,4) 0.0000 + 1.0000i (16,4) 0.0000 - 1.0000i (17,4) 0.5000 + 0.0000i (2,5) 0.0000 + 0.2500i (4,5) 0.0000 - 0.5000i (5,5) 5.0000 + 0.0000i (6,5) 0.0000 + 0.5000i (14,5) 0.5000 + 0.0000i (15,5) 0.0000 + 1.0000i (17,5) 0.0000 - 1.0000i (18,5) 0.5000 + 0.0000i (3,6) 0.0000 + 0.2500i (5,6) 0.0000 - 0.5000i (6,6) 5.0000 + 0.0000i (7,6) 0.0000 + 0.5000i (15,6) 0.5000 + 0.0000i (16,6) 0.0000 + 1.0000i (18,6) 0.0000 - 1.0000i (19,6) 0.5000 + 0.0000i (4,7) 0.0000 + 0.2500i (6,7) 0.0000 - 0.5000i (7,7) 5.0000 + 0.0000i (8,7) 0.0000 + 0.5000i (16,7) 0.5000 + 0.0000i (17,7) 0.0000 + 1.0000i (19,7) 0.0000 - 1.0000i (20,7) 0.5000 + 0.0000i (5,8) 0.0000 + 0.2500i (7,8) 0.0000 - 0.5000i (8,8) 5.0000 + 0.0000i (9,8) 0.0000 + 0.5000i (17,8) 0.5000 + 0.0000i (18,8) 0.0000 + 1.0000i (20,8) 0.0000 - 1.0000i (21,8) 0.5000 + 0.0000i (6,9) 0.0000 + 0.2500i (8,9) 0.0000 - 0.5000i (9,9) 5.0000 + 0.0000i (10,9) 0.0000 + 0.5000i (18,9) 0.5000 + 0.0000i (19,9) 0.0000 + 1.0000i (21,9) 0.0000 - 1.0000i (22,9) 0.5000 + 0.0000i (7,10) 0.0000 + 0.2500i (9,10) 0.0000 - 0.5000i (10,10) 5.0000 + 0.0000i (11,10) 0.0000 + 0.5000i (19,10) 0.5000 + 0.0000i (20,10) 0.0000 + 1.0000i (22,10) 0.0000 - 1.0000i (8,11) 0.0000 + 0.2500i (10,11) 0.0000 - 0.5000i (11,11) 5.0000 + 0.0000i (20,11) 0.5000 + 0.0000i (21,11) 0.0000 + 1.0000i (2,12) 0.0000 + 1.0000i (3,12) -0.0785 + 0.2374i (4,12) 0.1429 + 0.0000i (5,12) 0.0000 + 0.1250i (12,12) 1.0000 + 0.0000i (13,12) 2.0000 + 0.0000i (14,12) -1.0000 + 0.0000i (1,13) 0.0000 - 1.0000i (3,13) 0.0000 + 1.0000i (4,13) -0.0785 + 0.2374i (5,13) 0.1429 + 0.0000i (6,13) 0.0000 + 0.1250i (12,13) 2.0000 + 0.0000i (13,13) 1.0000 + 0.0000i (14,13) 2.0000 + 0.0000i (15,13) -1.0000 + 0.0000i (1,14) -0.0785 - 0.2374i (2,14) 0.0000 - 1.0000i (4,14) 0.0000 + 1.0000i (5,14) -0.0785 + 0.2374i (6,14) 0.1429 + 0.0000i (7,14) 0.0000 + 0.1250i (12,14) -1.0000 + 0.0000i (13,14) 2.0000 + 0.0000i (14,14) 1.0000 + 0.0000i (15,14) 2.0000 + 0.0000i (16,14) -1.0000 + 0.0000i (1,15) 0.3333 + 0.2000i (2,15) -0.0785 - 0.2374i (3,15) 0.0000 - 1.0000i (5,15) 0.0000 + 1.0000i (6,15) -0.0785 + 0.2374i (7,15) 0.1429 + 0.0000i (8,15) 0.0000 + 0.1250i (13,15) -1.0000 + 0.0000i (14,15) 2.0000 + 0.0000i (15,15) 1.0000 + 0.0000i (16,15) 2.0000 + 0.0000i (17,15) -1.0000 + 0.0000i (1,16) 0.0000 - 0.1250i (2,16) 0.3333 + 0.2000i (3,16) -0.0785 - 0.2374i (4,16) 0.0000 - 1.0000i (6,16) 0.0000 + 1.0000i (7,16) -0.0785 + 0.2374i (8,16) 0.1429 + 0.0000i (9,16) 0.0000 + 0.1250i (14,16) -1.0000 + 0.0000i (15,16) 2.0000 + 0.0000i (16,16) 1.0000 + 0.0000i (17,16) 2.0000 + 0.0000i (18,16) -1.0000 + 0.0000i (2,17) 0.0000 - 0.1250i (3,17) 0.3333 + 0.2000i (4,17) -0.0785 - 0.2374i (5,17) 0.0000 - 1.0000i (7,17) 0.0000 + 1.0000i (8,17) -0.0785 + 0.2374i (9,17) 0.1429 + 0.0000i (10,17) 0.0000 + 0.1250i (15,17) -1.0000 + 0.0000i (16,17) 2.0000 + 0.0000i (17,17) 1.0000 + 0.0000i (18,17) 2.0000 + 0.0000i (19,17) -1.0000 + 0.0000i (3,18) 0.0000 - 0.1250i (4,18) 0.3333 + 0.2000i (5,18) -0.0785 - 0.2374i (6,18) 0.0000 - 1.0000i (8,18) 0.0000 + 1.0000i (9,18) -0.0785 + 0.2374i (10,18) 0.1429 + 0.0000i (11,18) 0.0000 + 0.1250i (16,18) -1.0000 + 0.0000i (17,18) 2.0000 + 0.0000i (18,18) 1.0000 + 0.0000i (19,18) 2.0000 + 0.0000i (20,18) -1.0000 + 0.0000i (4,19) 0.0000 - 0.1250i (5,19) 0.3333 + 0.2000i (6,19) -0.0785 - 0.2374i (7,19) 0.0000 - 1.0000i (9,19) 0.0000 + 1.0000i (10,19) -0.0785 + 0.2374i (11,19) 0.1429 + 0.0000i (17,19) -1.0000 + 0.0000i (18,19) 2.0000 + 0.0000i (19,19) 1.0000 + 0.0000i (20,19) 2.0000 + 0.0000i (21,19) -1.0000 + 0.0000i (5,20) 0.0000 - 0.1250i (6,20) 0.3333 + 0.2000i (7,20) -0.0785 - 0.2374i (8,20) 0.0000 - 1.0000i (10,20) 0.0000 + 1.0000i (11,20) -0.0785 + 0.2374i (18,20) -1.0000 + 0.0000i (19,20) 2.0000 + 0.0000i (20,20) 1.0000 + 0.0000i (21,20) 2.0000 + 0.0000i (22,20) -1.0000 + 0.0000i (6,21) 0.0000 - 0.1250i (7,21) 0.3333 + 0.2000i (8,21) -0.0785 - 0.2374i (9,21) 0.0000 - 1.0000i (11,21) 0.0000 + 1.0000i (19,21) -1.0000 + 0.0000i (20,21) 2.0000 + 0.0000i (21,21) 1.0000 + 0.0000i (22,21) 2.0000 + 0.0000i (7,22) 0.0000 - 0.1250i (8,22) 0.3333 + 0.2000i (9,22) -0.0785 - 0.2374i (10,22) 0.0000 - 1.0000i (20,22) -1.0000 + 0.0000i (21,22) 2.0000 + 0.0000i (22,22) 1.0000 + 0.0000i
 
T=1 %period
T = 1
nx=2 %number of state
nx = 2
NTB(nx,h,T)
ans = 22×22 complex
0.0000 -31.4159i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -25.1327i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +25.1327i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
NBT(nx,h,T)
ans = 11×11 complex
0.0000 -31.4159i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -25.1327i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +25.1327i 0.0000 + 0.0000i
 
spNBT(nx,h,T)
ans = 11×11 sparse complex double matrix (10 nonzeros)
(1,1) 0.0000 -31.4159i (2,2) 0.0000 -25.1327i (3,3) 0.0000 -18.8496i (4,4) 0.0000 -12.5664i (5,5) 0.0000 - 6.2832i (7,7) 0.0000 + 6.2832i (8,8) 0.0000 +12.5664i (9,9) 0.0000 +18.8496i (10,10) 0.0000 +25.1327i (11,11) 0.0000 +31.4159i
spNTB(nx,h,T)
ans = 22×22 sparse complex double matrix (20 nonzeros)
(1,1) 0.0000 -31.4159i (2,2) 0.0000 -25.1327i (3,3) 0.0000 -18.8496i (4,4) 0.0000 -12.5664i (5,5) 0.0000 - 6.2832i (7,7) 0.0000 + 6.2832i (8,8) 0.0000 +12.5664i (9,9) 0.0000 +18.8496i (10,10) 0.0000 +25.1327i (11,11) 0.0000 +31.4159i (12,12) 0.0000 -31.4159i (13,13) 0.0000 -25.1327i (14,14) 0.0000 -18.8496i (15,15) 0.0000 -12.5664i (16,16) 0.0000 - 6.2832i (18,18) 0.0000 + 6.2832i (19,19) 0.0000 +12.5664i (20,20) 0.0000 +18.8496i (21,21) 0.0000 +25.1327i (22,22) 0.0000 +31.4159i
figure
barsurf(A.TB(10),'EdgeColor','interp')
view([0 90.00])
 
The 'N' function accept a phasorArray as first argument and deduce from the first dimension of the matrix the number of state
NTB(A,h,T)
ans = 22×22 complex
0.0000 -31.4159i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -25.1327i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 6.2832i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +12.5664i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +18.8496i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 +25.1327i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
to compute the square hankel form used in LMI use
[
BT hankel is not yet implemented
[HpJ,JHm,Hp,Hm]=A.TBHankel(h);
% [HpJ,JHm,Hp,Hm]=A.BTHankel(h);
 
%sparse versions
[HpJ,JHm,Hp,Hm]=A.spTBHankel(h);
compute eigenvalue of A and eigen value of A-N
A.HmqNEig(h,T)
ans = 22×1 complex
4.9408 +31.5134i 1.2209 +30.7901i 0.9628 +25.0510i 4.8707 +25.1389i 1.1404 +18.8692i 4.8639 +18.8476i 1.1349 +12.5668i 4.8663 +12.5652i 1.1336 + 6.2841i 4.8663 + 6.2822i
A.HmqEig(h)
ans = 22×1 complex
-4.5750 + 0.0195i -3.5242 + 0.0172i -1.9018 + 0.0134i 0.0831 - 0.0074i 2.2627 - 0.1248i 4.6578 - 1.8553i 4.8330 + 1.7653i 3.9595 + 1.5211i 3.6683 + 1.2792i 4.5414 + 1.2910i
 
Output sincos form, imag real form etc in the form of 3D array
u=ScalarPhasorArray([1 1/2 -1/2/1i],"z_pospart",1)
u = 1x1x5 PhasorArray of double representing a 1x1 real-valued periodic matrix with 2 harmonics
% u = 1 + cos - sin
figure
plot(u,1,0:0.01:2,title='u')
 
u.SinCosForm
ans =
ans(:,:,1) = -1 ans(:,:,2) = 0 ans(:,:,3) = 1 ans(:,:,4) = 1 ans(:,:,5) = 0
u.ImagRealForm
ans =
ans(:,:,1) = 0.5000 ans(:,:,2) = 0 ans(:,:,3) = 1 ans(:,:,4) = 0.5000 ans(:,:,5) = 0

Symbolic and sdpvar

The toolbox allows for definition of symbolic and sdp variable in the form of PhasorArray to perform all the previous operations
hP=5
hP = 5
 
%liste de sdp var servant aux phaseur
P2=(sdpvar(size(A,1),size(A,2),hP,'symmetric','complex'))
Multi-dimensional SDPVAR object 2x2x5
%sdpvar phaseur 0 (réel)
P1=(ndsdpvar(size(A,1),size(A,2),1,'symmetric','real'))
Linear matrix variable 2x2 (symmetric, real, 3 variables) Coefficient range: 1 to 1
%sdpvar phaseur array
P = PosPart2PhasorArray(P1,P2)
P = 2x2x11 PhasorArray of ndsdpvar representing a 2x2 real-valued periodic matrix with 5 harmonics
PT=P.TB(h)
Linear matrix variable 22x22 (hermitian, complex, 33 variables) Coefficient range: 1 to 1
 
%ou directement avec la methode statique de PhasorArray
P = PhasorArray.ndsdpvar(2,2,5,PhasorType='symmetric',real=true)
P = 2x2x11 PhasorArray of ndsdpvar representing a 2x2 real-valued periodic matrix with 5 harmonics
 
P=sdpval(P)
P = 2x2x11 PhasorArray of double representing a 2x2 complex-valued periodic matrix with 5 harmonics
% P = value(value(P))
%to extract the value in P after optim
see LMI example for more details
Also, symbolic phasorArray are available
S = PhasorArray.sym(2,2,5,'s')
S =
Warning: cannot evaluate reality of this sym phasor array, some sym variable may be ill-defined. > In PhasorArray/isreal (line 3918) In PhasorArray/getHeader (line 4457) In matlab.internal.editor.VariableOutputPackager.isolatedDisplaying In matlab.internal.editor.VariableOutputPackager.getStringFromVar In matlab.internal.editor.VariableOutputPackager.getTruncatedStringFromVar In matlab.internal.editor.VariableOutputPackager.packageVarOther In matlab.internal.editor.VariableOutputPackager.packageOutput In LiveEditorEvaluationHelperE1037835308 (line 263) 2x2x11 PhasorArray of sym representing a 2x2 complex-valued periodic matrix with 5 harmonics
S.TB(3)
ans = 
S.TBHankel(3)
ans = 
 
R = PhasorArray.random(2,2,2)
R = 2x2x5 PhasorArray of double representing a 2x2 real-valued periodic matrix with 2 harmonics
 
SymPlusR=TB(S+R,3)
SymPlusR = 
vpa(SymPlusR,3)
ans = 
SymTimesR=TB(S*R,3)
Warning: cannot evaluate reality of this sym phasor array, some sym variable may be ill-defined.
Warning: cannot evaluate reality of this sym phasor array, some sym variable may be ill-defined.
SymTimesR = 
vpa(SymTimesR,3)
ans = 

Lyapunov and Sylvester eq

A=mreal(rand_phasor(4,4,7,"hurwitzeig",[-1 -0.7 -0.1 -0.3],"time_structure","hurwitz",output="PhasorArray"))
A = 4x4x15 PhasorArray of double representing a 4x4 real-valued periodic matrix with 7 harmonics
Q=PhasorArray(eye(4));
 
hp=10;
T0=1;
 
%A^TP + PA +Q =0
P=PhasorArray(Sylv_harmonique(A',A,Q,2*hp,2*pi/T0));
figure
plot(P)
 
nx=size(A,1)
nx = 4
nz=2
nz = 2
 
C=PhasorArray(rand_phasor(nz,nx,4,"time_structure","real"))
C = 2x4x9 PhasorArray of double representing a 2x4 real-valued periodic matrix with 4 harmonics
O=rand(nz,nz)
O = 2×2
0.1625 0.9129 0.1136 0.4817
 
%-OM + MA -C =0
M=PhasorArray(Sylv_harmonique(-O,A,-C,2*hp,2*pi/T0));
plot(M)
 

More...

 
% les formes fourier au lieu de Toepliz
S.TF_BT
ans = 
S.TF_TB
ans = 
 
 
%forme Fourier vec en TB
S.FvTB(h)
ans = 
S{:}.TF_BT
ans = 
 
%TB2Array converti une matrice TB, dont on connait le nombre de bloc, pour
%en reconstruite le phasorArray 3D
TB2array(A.TB(h),size(A,1))
ans =
ans(:,:,1) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,2) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,3) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,4) = -0.0040 + 0.0040i -0.0011 + 0.0011i 0.0007 - 0.0009i -0.0008 + 0.0000i -0.0019 + 0.0013i -0.0017 + 0.0010i 0.0003 - 0.0000i 0.0001 + 0.0005i -0.0002 - 0.0025i -0.0003 + 0.0009i 0.0001 + 0.0004i 0.0000 + 0.0011i -0.0034 - 0.0034i 0.0002 + 0.0006i 0.0005 + 0.0012i -0.0004 - 0.0001i ans(:,:,5) = -0.0000 - 0.0018i -0.0004 - 0.0010i -0.0001 + 0.0003i -0.0009 + 0.0002i 0.0023 + 0.0000i 0.0091 + 0.0050i -0.0012 - 0.0008i -0.0012 - 0.0023i -0.0022 - 0.0013i -0.0029 - 0.0032i 0.0006 + 0.0004i -0.0003 + 0.0017i -0.0066 - 0.0015i -0.0055 - 0.0072i 0.0012 + 0.0016i 0.0028 + 0.0004i ans(:,:,6) = 0.0140 + 0.0211i 0.0070 - 0.0009i -0.0026 - 0.0030i 0.0017 + 0.0026i 0.0118 - 0.0141i 0.0011 - 0.0005i -0.0014 + 0.0029i 0.0008 - 0.0018i -0.0033 + 0.0072i 0.0029 + 0.0058i 0.0006 - 0.0016i -0.0003 + 0.0002i 0.0042 + 0.0054i 0.0002 - 0.0012i -0.0007 - 0.0010i 0.0001 - 0.0004i ans(:,:,7) = -0.0134 - 0.0042i -0.0001 - 0.0011i 0.0017 + 0.0008i -0.0003 - 0.0010i 0.0055 + 0.0020i -0.0014 + 0.0029i -0.0006 - 0.0007i 0.0000 + 0.0000i -0.0259 + 0.0005i -0.0040 - 0.0010i 0.0115 - 0.0007i -0.0026 - 0.0002i 0.0077 - 0.0040i -0.0000 - 0.0009i -0.0016 + 0.0006i 0.0008 + 0.0007i ans(:,:,8) = 0.1544 + 0.0277i 0.0095 + 0.0032i -0.0239 - 0.0007i 0.0105 + 0.0018i -0.0423 + 0.0026i -0.0014 + 0.0024i 0.0077 + 0.0003i -0.0084 + 0.0013i 0.0032 + 0.0698i 0.0085 + 0.0108i -0.0004 - 0.0084i -0.0039 + 0.0021i -0.0077 - 0.0009i -0.0145 + 0.0047i 0.0000 - 0.0022i 0.0149 + 0.0013i ans(:,:,9) = -0.0217 + 0.0125i -0.0082 + 0.0106i 0.0023 + 0.0005i -0.0065 + 0.0134i -0.0187 + 0.0418i 0.0090 + 0.0045i 0.0082 - 0.0098i -0.0028 + 0.0103i -0.0325 + 0.0352i 0.0220 - 0.0200i 0.0168 - 0.0078i 0.0127 - 0.0030i -0.0603 + 0.1107i -0.0147 + 0.0377i 0.0186 - 0.0209i -0.0189 - 0.0128i ans(:,:,10) = 0.2770 - 0.0135i 0.0231 - 0.0436i -0.0525 + 0.0132i 0.0316 + 0.0066i 0.0009 - 0.0910i 0.1718 - 0.0001i -0.0069 - 0.0016i 0.0049 - 0.0315i -0.0977 + 0.2880i -0.0170 - 0.0348i 0.0141 - 0.0418i -0.0228 + 0.0535i 0.0762 - 0.0300i 0.0103 - 0.0790i -0.0204 + 0.0234i -0.0152 + 0.0334i ans(:,:,11) = -1.4320 + 0.0000i -0.1293 + 0.0000i 0.2085 + 0.0000i -0.0935 + 0.0000i 0.0273 + 0.0000i -0.7017 + 0.0000i 0.0193 + 0.0000i -0.0020 + 0.0000i -2.3914 + 0.0000i -0.4816 + 0.0000i 0.2825 + 0.0000i -0.1928 + 0.0000i 0.6028 + 0.0000i 0.1065 + 0.0000i -0.1022 + 0.0000i -0.2488 + 0.0000i ans(:,:,12) = 0.2770 + 0.0135i 0.0231 + 0.0436i -0.0525 - 0.0132i 0.0316 - 0.0066i 0.0009 + 0.0910i 0.1718 + 0.0001i -0.0069 + 0.0016i 0.0049 + 0.0315i -0.0977 - 0.2880i -0.0170 + 0.0348i 0.0141 + 0.0418i -0.0228 - 0.0535i 0.0762 + 0.0300i 0.0103 + 0.0790i -0.0204 - 0.0234i -0.0152 - 0.0334i ans(:,:,13) = -0.0217 - 0.0125i -0.0082 - 0.0106i 0.0023 - 0.0005i -0.0065 - 0.0134i -0.0187 - 0.0418i 0.0090 - 0.0045i 0.0082 + 0.0098i -0.0028 - 0.0103i -0.0325 - 0.0352i 0.0220 + 0.0200i 0.0168 + 0.0078i 0.0127 + 0.0030i -0.0603 - 0.1107i -0.0147 - 0.0377i 0.0186 + 0.0209i -0.0189 + 0.0128i ans(:,:,14) = 0.1544 - 0.0277i 0.0095 - 0.0032i -0.0239 + 0.0007i 0.0105 - 0.0018i -0.0423 - 0.0026i -0.0014 - 0.0024i 0.0077 - 0.0003i -0.0084 - 0.0013i 0.0032 - 0.0698i 0.0085 - 0.0108i -0.0004 + 0.0084i -0.0039 - 0.0021i -0.0077 + 0.0009i -0.0145 - 0.0047i 0.0000 + 0.0022i 0.0149 - 0.0013i ans(:,:,15) = -0.0134 + 0.0042i -0.0001 + 0.0011i 0.0017 - 0.0008i -0.0003 + 0.0010i 0.0055 - 0.0020i -0.0014 - 0.0029i -0.0006 + 0.0007i 0.0000 - 0.0000i -0.0259 - 0.0005i -0.0040 + 0.0010i 0.0115 + 0.0007i -0.0026 + 0.0002i 0.0077 + 0.0040i -0.0000 + 0.0009i -0.0016 - 0.0006i 0.0008 - 0.0007i ans(:,:,16) = 0.0140 - 0.0211i 0.0070 + 0.0009i -0.0026 + 0.0030i 0.0017 - 0.0026i 0.0118 + 0.0141i 0.0011 + 0.0005i -0.0014 - 0.0029i 0.0008 + 0.0018i -0.0033 - 0.0072i 0.0029 - 0.0058i 0.0006 + 0.0016i -0.0003 - 0.0002i 0.0042 - 0.0054i 0.0002 + 0.0012i -0.0007 + 0.0010i 0.0001 + 0.0004i ans(:,:,17) = -0.0000 + 0.0018i -0.0004 + 0.0010i -0.0001 - 0.0003i -0.0009 - 0.0002i 0.0023 - 0.0000i 0.0091 - 0.0050i -0.0012 + 0.0008i -0.0012 + 0.0023i -0.0022 + 0.0013i -0.0029 + 0.0032i 0.0006 - 0.0004i -0.0003 - 0.0017i -0.0066 + 0.0015i -0.0055 + 0.0072i 0.0012 - 0.0016i 0.0028 - 0.0004i ans(:,:,18) = -0.0040 - 0.0040i -0.0011 - 0.0011i 0.0007 + 0.0009i -0.0008 - 0.0000i -0.0019 - 0.0013i -0.0017 - 0.0010i 0.0003 + 0.0000i 0.0001 - 0.0005i -0.0002 + 0.0025i -0.0003 - 0.0009i 0.0001 - 0.0004i 0.0000 - 0.0011i -0.0034 + 0.0034i 0.0002 - 0.0006i 0.0005 - 0.0012i -0.0004 + 0.0001i ans(:,:,19) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,20) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i ans(:,:,21) = 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
 
 
sum(A,1)
ans = 1x4x15 PhasorArray of double representing a 1x4 real-valued periodic matrix with 7 harmonics
permute(A,[2 1])
ans = 4x4x15 PhasorArray of double representing a 4x4 real-valued periodic matrix with 7 harmonics
size(A,1)
ans = 4
size(A,2)
ans = 4
numel(A)
ans = 240
numelt(A)
ans = 16
 
angle=1.57 %rad
angle = 1.5700
evalp(A,angle)
ans = 4×4
-1.4636 -0.2100 0.2311 -0.0646 -0.1462 -0.7485 0.0061 -0.0638 -1.9182 -0.6093 0.2000 -0.1218 0.7119 -0.0240 -0.0983 -0.1517
 
B=rand_phasor(3,1,7,'output','PhasorArray')
B = 3x1x15 PhasorArray of double representing a 3x1 real-valued periodic matrix with 7 harmonics
iscolumn(B)
ans = logical
1
isrow(B)
ans = logical
0
isrow(B.')
ans = logical
1
ismatrix(B)
ans = logical
1
issquare(B)
ans = logical
0
 
C=rand_phasor(1,1,8,'output','PhasorArray')
C = 1x1x17 PhasorArray of double representing a 1x1 real-valued periodic matrix with 8 harmonics
isscalar(C)
ans = logical
1
 
issquare(A)
ans = logical
1
 
figure
plot(A)
figure
plot(retro(A))